﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace FxWinSuper.Util
{
	public class CommPropConvert : IValueConverter
	{
		public Func<object, object> ConvertDelegate { get; }

		public CommPropConvert(Func<object, object> convertDelegate)
		{
			ConvertDelegate = convertDelegate;
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return ConvertDelegate?.Invoke(value);
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return ConvertDelegate?.Invoke(value);
		}
	}
}
